package net.whg.java.callback;

public class AsyncTask {

    private TaskCallback callback;

    public AsyncTask(TaskCallback callback) {
        this.callback = callback;
    }

    public void execute(){
        System.out.println("模拟执行任务");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        callback.onTaskComplete();
    }

}
